/*
 * Copyright (C) 2010-2011 dppc.org
 * All rights reserved.
 */
package com.seemsea.web.app;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 人民币大写转换
 * 
 * @author chirowong
 * @version 1.0 2011-6-13
 * @since 1.0
 */
@Controller
public class AppMoneyChangeController {
	@RequestMapping(value="/app/moneyChange.nhtml")
	    public String init(Model model,HttpServletRequest request) {
		String type = request.getParameter("type"); 
		if(type == null || "".equals(type)){
			type = "seemsea";
		}
        return "/app/moneyChange/"+type+"/index";
    }
	
/*	@RequestMapping(value="/app/qihoo/getResult.nhtml")
    public void getResult(HttpServletResponse response,HttpServletRequest request) {
        Map<String,Object> jsonMap = new HashMap<String,Object>();
        jsonMap.put("img", "");
        Gson gson = new Gson();
        String result = gson.toJson(jsonMap);
        ControllerUtils.responseClientWithJson(response, result);
	}*/
	
	/*public static void main(String agrs[]) {
		Change change = new Change("1011.22");
		System.out.println(change.change());
		
		// Money用于存放输入的金额数
		long Money = 0;
		String Mon[] = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };

		String Mon1[] = { "拾", "佰", "仟", "万", "拾万", "百万", "仟万", "亿", "拾亿",
				"百亿", "仟亿" }, je[] = new String[30];// je[]数组用于存放数字金额被转换后的数字

		// n用于测试您是否有金额转换
		//int n = agrs.length;
		int n = 10110;

		if (n == 0)
			System.out.println("请输入需要转换的金额：");

		// 将输入的金额转化成long型的数据
		else {
			//Money = Long.parseLong(agrs[n - 1]);
		}
		Money = 10110;
		// bitt用于存放第几个需转换的金额数字，
		int bitt = 0, j, k = -1, i = 0;

		// 转换过程
		while (Money != 0) {
			bitt = (int) (Money % 10L);

			// 计算出每个数字对应的大写值
			for (j = 0; j < Mon.length; j++) {
				if (j == bitt)
					break;
			}

			// 将相应的值存入je[]中
			if (k != -1) {
				je[i] = Mon1[k];
				i++;
			}
			je[i] = Mon[j];
			i++;
			Money = Money / 10;
			k++;
			if (Money == 0) {
				// 输出转换后的金额
				System.out.print("您输入的金额为：");
				i--;
				for (; i >= 0; i--)
					System.out.print(je[i]);
			}

		}

	}*/
}
